<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 500px;
            height: 300px;
            background-color: aqua;
            margin: auto;
        }
    </style>
</head>
<body>
    <div class="box">
        <p>抽奖</p>
        <h1>一等奖:<span class="first">?</span></h1>
        <h2>二等奖:<span class="second">?</span></h1>
        <h3>三等奖:<span class="third">?</span></h1>
    </div>
    <script>
        const  arr=['张飞','赵云','马超','曹操','貂蝉']

        const g=Math.floor(Math.random()*arr.length)

        const span1=document.querySelector('.first')
        span1.innerHTML=arr[g]
        arr.splice(g,1)
        console.log(arr) 

         const g2=Math.floor(Math.random()*arr.length)
        const span2=document.querySelector('.second')
        span2.innerHTML=arr[g2]
        arr.splice(g2,1)
        console.log(arr)

         const g3=Math.floor(Math.random()*arr.length)
        const span3=document.querySelector('.third')
        span3.innerHTML=arr[g3]
        arr.splice(g3,1)
        console.log(arr)
    
    </script>
</body>
</html>